home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 26 / AACD 26.iso / AACD / Games / WHDLoad / Include / whdload.i < prev    next >
Encoding:
Text File  |  2001-09-23  |  17.9 KB  |  566 lines

  1. ;*---------------------------------------------------------------------------
  2. ;  :Module.    whdload.i
  3. ;  :Contens.    include file for WHDLoad and Slaves
  4. ;  :Author.    Bert Jahn
  5. ;  :EMail.    wepl@whdload.org
  6. ;  :Address.    Franz-Liszt-Straße 16, Rudolstadt, 07404, Germany
  7. ;  :Version.    $Id: whdload.i 14.5 2001/09/23 09:55:05 wepl Exp wepl $
  8. ;  :History.    11.04.99 marcos moved to separate include file
  9. ;        08.05.99 resload_Patch added
  10. ;        09.03.00 new stuff for whdload v11
  11. ;        10.07.00 new stuff for whdload v12
  12. ;        25.11.00 new stuff for whdload v13
  13. ;        13.01.01 some comments spelling errors fixed
  14. ;        15.03.01 v14 stuff added
  15. ;        15.04.01 FAILMSG added
  16. ;        29.04.01 resload_Relocate tags added
  17. ;  :Copyright.    © 1996-2001 Bert Jahn, All Rights Reserved
  18. ;  :Language.    68000 Assembler
  19. ;  :Translator.    Barfly 2.9, Asm-Pro 1.16, PhxAss 4.38
  20. ;---------------------------------------------------------------------------*
  21.  
  22.  IFND WHDLOAD_I
  23. WHDLOAD_I=1
  24.  
  25.     IFND    EXEC_EXECBASE_I
  26.     INCLUDE    exec/execbase.i
  27.     ENDC
  28.     IFND    EXEC_TYPES_I
  29.     INCLUDE    exec/types.i
  30.     ENDC
  31.     IFND    GRAPHICS_MODEID_I
  32.     INCLUDE    graphics/modeid.i
  33.     ENDC
  34.     IFND    UTILITY_TAGITEM_I
  35.     INCLUDE    utility/tagitem.i
  36.     ENDC
  37.  
  38. ;=============================================================================
  39. ;    misc
  40. ;=============================================================================
  41.  
  42. SLAVE_HEADER    MACRO
  43.         moveq    #-1,d0
  44.         rts
  45.         dc.b    "WHDLOADS"
  46.         ENDM
  47.  
  48. ;=============================================================================
  49. ;    return-values for termination (resload_Abort)
  50. ;=============================================================================
  51.  
  52. TDREASON_OK        = -1    ;normal termination
  53. TDREASON_DOSREAD    = 1    ;error caused by resload_ReadFile
  54.                 ; primary   = dos errorcode
  55.                 ; secondary = file name
  56. TDREASON_DOSWRITE    = 2    ;error caused by resload_SaveFile or
  57.                 ;resload_SaveFileOffset
  58.                 ; primary   = dos errorcode
  59.                 ; secondary = file name
  60. TDREASON_DEBUG        = 5    ;cause WHDLoad to make a coredump and quit
  61.                 ; primary   = PC (writing to dump files)
  62.                 ; secondary = SR (writing to dump files)
  63. TDREASON_DOSLIST    = 6    ;error caused by resload_ListFiles
  64.                 ; primary   = dos errorcode
  65.                 ; secondary = directory name
  66. TDREASON_DISKLOAD    = 7    ;error caused by resload_DiskLoad
  67.                 ; primary   = dos errorcode
  68.                 ; secondary = disk number
  69. TDREASON_DISKLOADDEV    = 8    ;error caused by resload_DiskLoadDev
  70.                 ; primary   = trackdisk errorcode
  71. TDREASON_WRONGVER    = 9    ;an version check (e.g. crc16) has detected an
  72.                 ;unsupported version of the installed program
  73. TDREASON_OSEMUFAIL    = 10    ;error in the OS emulation module
  74.                 ; primary   = subsystem (e.g. "exec.library")
  75.                 ; secondary = error number (e.g. _LVOAllocMem)
  76. ; version 7
  77. TDREASON_REQ68020    = 11    ;installed program requires a MC68020
  78. TDREASON_REQAGA        = 12    ;installed program requires the AGA chip set
  79. TDREASON_MUSTNTSC    = 13    ;installed program needs NTSC videomode to run
  80. TDREASON_MUSTPAL    = 14    ;installed program needs PAL videomode to run
  81. ; version 8
  82. TDREASON_MUSTREG    = 15    ;WHDLoad must be registered
  83. TDREASON_DELETEFILE    = 27    ;error caused by resload_DeleteFile
  84.                 ; primary   = dos errorcode
  85.                 ; secondary = file name
  86. ; version 14.1
  87. TDREASON_FAILMSG    = 43    ;failure with variable message text
  88.                 ; primary   = text
  89.  
  90. ;=============================================================================
  91. ; tagitems for the resload_Control function
  92. ;=============================================================================
  93.  
  94.  ENUM    TAG_USER+$8000000
  95.  EITEM    WHDLTAG_ATTNFLAGS_GET    ;get info about current CPU/FPU/MMU
  96.  EITEM    WHDLTAG_ECLOCKFREQ_GET    ;get frequency custom chips operate on
  97.  EITEM    WHDLTAG_MONITOR_GET    ;get the used monitor/video mode
  98.                 ;(NTSC_MONITOR_ID or PAL_MONITOR_ID)
  99.  EITEM    WHDLTAG_Private1
  100.  EITEM    WHDLTAG_Private2
  101.  EITEM    WHDLTAG_Private3
  102.  EITEM    WHDLTAG_BUTTONWAIT_GET    ;get value of WHDLoad option ButtonWait/S (0/-1)
  103.  EITEM    WHDLTAG_CUSTOM1_GET    ;get value of WHDLoad option Custom1/N (integer)
  104.  EITEM    WHDLTAG_CUSTOM2_GET    ;get value of WHDLoad option Custom2/N (integer)
  105.  EITEM    WHDLTAG_CUSTOM3_GET    ;get value of WHDLoad option Custom3/N (integer)
  106.  EITEM    WHDLTAG_CUSTOM4_GET    ;get value of WHDLoad option Custom4/N (integer)
  107.  EITEM    WHDLTAG_CUSTOM5_GET    ;get value of WHDLoad option Custom5/N (integer)
  108. ; version 7
  109.  EITEM    WHDLTAG_CBSWITCH_SET    ;set a function to be executed during switch
  110.                 ;from operating system to installed program
  111.  EITEM    WHDLTAG_CHIPREVBITS_GET    ;get info about current custom chip set
  112. ; version 8
  113.  EITEM    WHDLTAG_IOERR_GET    ;get last dos errorcode
  114.  EITEM    WHDLTAG_Private4
  115. ; version 9
  116.  EITEM    WHDLTAG_CBAF_SET    ;set a function to be executed when an access
  117.                 ;fault exception occurs
  118.  EITEM    WHDLTAG_VERSION_GET    ;get WHDLoad major version number
  119.  EITEM    WHDLTAG_REVISION_GET    ;get WHDLoad minor version number
  120.  EITEM    WHDLTAG_BUILD_GET    ;get WHDLoad build number
  121.  EITEM    WHDLTAG_TIME_GET    ;get current time and date
  122. ; version 11
  123.  EITEM    WHDLTAG_BPLCON0_GET    ;get system bplcon0
  124. ; version 12
  125.  EITEM    WHDLTAG_KEYTRANS_GET    ;get pointer to a 128 byte table to convert
  126.                 ;rawkey's to ascii-chars
  127. ; version 13
  128.  EITEM    WHDLTAG_CHKBLTWAIT    ;enable/disable blitter wait check
  129.  EITEM    WHDLTAG_CHKBLTSIZE    ;enable/disable blitter size check
  130.  EITEM    WHDLTAG_CHKBLTHOG    ;enable/disable dmacon.blithog (bltpri) check
  131.  EITEM    WHDLTAG_CHKCOLBST    ;enable/disable bplcon0.color check
  132. ; version 14
  133.  EITEM    WHDLTAG_LANG_GET    ;GetLanguageSelection like lowlevel.library
  134. ; version 14.5
  135.  EITEM    WHDLTAG_DBGADR_SET    ;set debug base address
  136.  
  137. ;=============================================================================
  138. ; tagitems for the resload_Relocate function
  139. ;=============================================================================
  140.  
  141. ; version 14.1
  142.  ENUM    TAG_USER+$8100000
  143.  EITEM    WHDLTAG_CHIPPTR        ;relocate MEMF_CHIP hunks to this address
  144.  EITEM    WHDLTAG_FASTPTR        ;relocate MEMF_FAST hunks to this address
  145.  
  146. ;=============================================================================
  147. ;    structure returned by WHDLTAG_TIME_GET
  148. ;=============================================================================
  149.  
  150.     STRUCTURE whdload_time,0
  151.         ULONG    whdlt_days    ;days since 1.1.1978
  152.         ULONG    whdlt_mins    ;minutes since last day
  153.         ULONG    whdlt_ticks    ;1/50 seconds since last minute
  154.         UBYTE    whdlt_year    ;78..77 (1978..2077)
  155.         UBYTE    whdlt_month    ;1..12
  156.         UBYTE    whdlt_day    ;1..31
  157.         UBYTE    whdlt_hour    ;0..23
  158.         UBYTE    whdlt_min    ;0..59
  159.         UBYTE    whdlt_sec    ;0..59
  160.         LABEL    whdlt_SIZEOF
  161.  
  162. ;=============================================================================
  163. ; Slave        Version 1..3
  164. ;=============================================================================
  165.  
  166.     STRUCTURE    WHDLoadSlave,0
  167.     STRUCT    ws_Security,4
  168.     STRUCT    ws_ID,8        ;"WHDLOADS"
  169.     UWORD    ws_Version    ;required WHDLoad version
  170.     UWORD    ws_Flags    ;see below
  171.     ULONG    ws_BaseMemSize    ;size of required memory (multiple of $1000)
  172.     ULONG    ws_ExecInstall    ;must be 0
  173.     RPTR    ws_GameLoader    ;Slave code, called by WHDLoad
  174.     RPTR    ws_CurrentDir    ;subdirectory for data files
  175.     RPTR    ws_DontCache    ;pattern for files not to cache
  176.  
  177. ;=============================================================================
  178. ; additional    Version 4..7
  179. ;=============================================================================
  180.  
  181.     UBYTE    ws_keydebug    ;raw key code to quit with debug
  182.                 ;works only if vbr is moved !
  183.                 ;=0 means no key
  184.     UBYTE    ws_keyexit    ;raw key code to exit
  185.                 ;works only if vbr is moved !
  186.                 ;=0 means no key
  187.  
  188. ;=============================================================================
  189. ; additional    Version 8..9
  190. ;=============================================================================
  191.  
  192.     ULONG    ws_ExpMem    ;size of required expansions memory, during
  193.                 ;initialisation overwritten by WHDLoad with
  194.                 ;address of the memory (multiple of $1000)
  195.                 ;if negative it is optional
  196.  
  197. ;=============================================================================
  198. ; additional    Version 10
  199. ;=============================================================================
  200.  
  201.     RPTR    ws_name        ;name of the installed program
  202.     RPTR    ws_copy        ;year and owner of the copyright
  203.     RPTR    ws_info        ;additional informations (author, version...)
  204.     LABEL    ws_SIZEOF
  205.  
  206. ;=============================================================================
  207. ; Flags for ws_Flags
  208. ;=============================================================================
  209.  
  210.     BITDEF WHDL,Disk,0    ;means diskimages are used by the Slave
  211.                 ;starting WHDLoad 0.107 obsolete
  212.     BITDEF WHDL,NoError,1    ;forces WHDLoad to abort the installed program
  213.                 ;if error during resload_#? function occurs
  214.     BITDEF WHDL,EmulTrap,2    ;forward "trap #n" exceptions to the handler
  215.                 ;of the installed program
  216.     BITDEF WHDL,NoDivZero,3    ;ignore division by zero exceptions
  217. ; version 7
  218.     BITDEF WHDL,Req68020,4    ;abort if no MC68020 or better is available
  219.     BITDEF WHDL,ReqAGA,5    ;abort if no AGA chipset is available
  220. ; version 8
  221.     BITDEF WHDL,NoKbd,6    ;says WHDLoad that it doesn't should get the
  222.                 ;keycode from the keyboard in conjunction with
  223.                 ;NoVBRMove, must be used if the installed
  224.                 ;program checks the keyboard from the VBI
  225.     BITDEF WHDL,EmulLineA,7    ;forward "line-a" exceptions to the handler
  226.                 ;of the installed program
  227. ; version 9
  228.     BITDEF WHDL,EmulTrapV,8    ;forward "trapv" exceptions to the handler
  229.                 ;of the installed program
  230. ; version 11
  231.     BITDEF WHDL,EmulChk,9    ;forward "chk, chk2" exceptions to the handler
  232.                 ;of the installed program
  233.     BITDEF WHDL,EmulPriv,10    ;forward 'privilege violation' exceptions to
  234.                 ;the handler of the installed program
  235. ; version 12
  236.     BITDEF WHDL,EmulLineF,11 ;forward "line-f" exceptions to the handler
  237.                 ;of the installed program
  238. ; version 13
  239.     BITDEF WHDL,ClearMem,12    ;initialize BaseMem and ExpMem with 0
  240.  
  241. ;=============================================================================
  242. ; properties for resload_SetCPU
  243. ;=============================================================================
  244.  
  245. WCPUF_Base    = 3        ;BaseMem mask
  246. WCPUF_Base_NCS    = 0        ;BaseMem = non cacheable serialized
  247. WCPUF_Base_NC    = 1        ;BaseMem = non cacheable
  248. WCPUF_Base_WT    = 2        ;BaseMem = cacheable write through
  249. WCPUF_Base_CB    = 3        ;BaseMem = cacheable copyback
  250. WCPUF_Exp    = 12        ;ExpMem mask
  251. WCPUF_Exp_NCS    = 0        ;ExpMem = non cacheable serialized
  252. WCPUF_Exp_NC    = 4        ;ExpMem = non cacheable
  253. WCPUF_Exp_WT    = 8        ;ExpMem = cacheable write through
  254. WCPUF_Exp_CB    = 12        ;ExpMem = cacheable copyback
  255. WCPUF_Slave    = 48        ;Slave mask
  256. WCPUF_Slave_NCS    = 0        ;Slave = non cacheable serialized
  257. WCPUF_Slave_NC    = 16        ;Slave = non cacheable
  258. WCPUF_Slave_WT    = 32        ;Slave = cacheable write through
  259. WCPUF_Slave_CB    = 48        ;Slave = cacheable copyback
  260.  
  261.     BITDEF WCPU,IC,8    ;instruction cache (20-60)
  262.     BITDEF WCPU,DC,9    ;data cache (30-60)
  263.     BITDEF WCPU,NWA,10    ;disable write allocation (30)
  264.     BITDEF WCPU,SB,11    ;store buffer (60)
  265.     BITDEF WCPU,BC,12    ;branch cache (60)
  266.     BITDEF WCPU,SS,13    ;superscalar dispatch (60)
  267.     BITDEF WCPU,FPU,14    ;enable fpu (60)
  268.  
  269. WCPUF_All    = WCPUF_Base!WCPUF_Exp!WCPUF_Slave!WCPUF_IC!WCPUF_DC!WCPUF_NWA!WCPUF_SB!WCPUF_BC!WCPUF_SS!WCPUF_FPU
  270.  
  271. ;=============================================================================
  272. ; resload_#? functions
  273. ; a JMP-tower inside WHDLoad (similar to a library)
  274. ; base is given on startup via A0
  275. ;=============================================================================
  276.  
  277.     STRUCTURE    ResidentLoader,0
  278.     ULONG    resload_Install        ;private
  279.     ULONG    resload_Abort
  280.         ; return to operating system
  281.         ; IN: (a7) = ULONG  reason for aborting
  282.         ;   (4,a7) = ULONG  primary error code
  283.         ;   (8,a7) = ULONG  secondary error code
  284.         ; ATTENTION this routine must called via JMP! (not JSR)
  285.     ULONG    resload_LoadFile
  286.         ; load file to memory
  287.         ; IN :    a0 = CPTR   filename
  288.         ;    a1 = APTR   address
  289.         ; OUT :    d0 = ULONG  success (size of file)
  290.         ;    d1 = ULONG  dos errorcode
  291.     ULONG    resload_SaveFile
  292.         ; write memory to file
  293.         ; IN :    d0 = LONG   size
  294.         ;    a0 = CPTR   filename
  295.         ;    a1 = APTR   address
  296.         ; OUT :    d0 = BOOL   success
  297.         ;    d1 = ULONG  dos errorcode
  298.     ULONG    resload_SetCACR
  299.         ; set cachebility for BaseMem
  300.         ; IN :    d0 = ULONG  new setup
  301.         ;    d1 = ULONG  mask
  302.         ; OUT :    d0 = ULONG  old setup
  303.     ULONG    resload_ListFiles
  304.         ; list filenames of directory
  305.         ; IN :    d0 = ULONG  buffer size
  306.         ;    a0 = CPTR   name of directory to scan
  307.         ;    a1 = APTR   buffer (must be located in Slave)
  308.         ; OUT :    d0 = ULONG  amount of names in buffer
  309.         ;    d1 = ULONG  dos errorcode
  310.     ULONG    resload_Decrunch
  311.         ; uncompress data in memory
  312.         ; IN :    a0 = APTR   source
  313.         ;    a1 = APTR   destination (can be equal to source)
  314.         ; OUT :    d0 = ULONG  uncompressed size
  315.     ULONG    resload_LoadFileDecrunch
  316.         ; load file and uncompress
  317.         ; IN :    a0 = CPTR   filename
  318.         ;    a1 = APTR   address
  319.         ; OUT :    d0 = ULONG  success (size of file)
  320.         ;    d1 = ULONG  dos errorcode
  321.     ULONG    resload_FlushCache
  322.         ; clear CPU caches
  323.         ; IN :    -
  324.         ; OUT :    -
  325.     ULONG    resload_GetFileSize
  326.         ; get size of a file
  327.         ; IN :    a0 = CPTR   filename
  328.         ; OUT :    d0 = ULONG  size of file
  329.     ULONG    resload_DiskLoad
  330.         ; load part from diskimage
  331.         ; IN :    d0 = ULONG  offset
  332.         ;    d1 = ULONG  size
  333.         ;    d2 = ULONG  disk number
  334.         ;    a0 = APTR   destination
  335.         ; OUT :    d0 = BOOL   success
  336.         ;    d1 = ULONG  dos errorcode
  337.  
  338. ******* the following functions require ws_Version >= 2
  339.  
  340.     ULONG    resload_DiskLoadDev
  341.         ; IN :    d0 = ULONG  offset
  342.         ;    d1 = ULONG  size
  343.         ;    a0 = APTR   destination
  344.         ;    a1 = STRUCT taglist
  345.         ; OUT :    d0 = BOOL   success
  346.         ;    d1 = ULONG  trackdisk errorcode
  347.  
  348. ******* the following functions require ws_Version >= 3
  349.  
  350.     ULONG    resload_CRC16
  351.         ; calculate 16 bit CRC checksum
  352.         ; IN :    d0 = ULONG  size
  353.         ;    a0 = APTR   address
  354.         ; OUT :    d0 = UWORD  CRC checksum
  355.  
  356. ******* the following functions require ws_Version >= 5
  357.  
  358.     ULONG    resload_Control
  359.         ; IN :    a0 = STRUCT taglist
  360.         ; OUT :    d0 = BOOL   success
  361.     ULONG    resload_SaveFileOffset
  362.         ; write memory to file at offset
  363.         ; IN :    d0 = ULONG  size
  364.         ;    d1 = ULONG  offset
  365.         ;    a0 = CPTR   filename
  366.         ;    a1 = APTR   address
  367.         ; OUT :    d0 = BOOL   success
  368.         ;    d1 = ULONG  dos errcode
  369.  
  370. ******* the following functions require ws_Version >= 6
  371.  
  372.     ULONG    resload_ProtectRead
  373.         ; mark memory as read protected
  374.         ; IN :    d0 = ULONG  length
  375.         ;    a0 = CPTR   address
  376.         ; OUT :    -
  377.     ULONG    resload_ProtectReadWrite
  378.         ; mark memory as read and write protected
  379.         ; IN :    d0 = ULONG  length
  380.         ;    a0 = CPTR   address
  381.         ; OUT :    -
  382.     ULONG    resload_ProtectWrite
  383.         ; mark memory as write protected
  384.         ; IN :    d0 = ULONG  length
  385.         ;    a0 = CPTR   address
  386.         ; OUT :    -
  387.     ULONG    resload_ProtectRemove
  388.         ; remove memory protection
  389.         ; IN :    d0 = ULONG  length
  390.         ;    a0 = CPTR   address
  391.         ; OUT :    -
  392.     ULONG    resload_LoadFileOffset
  393.         ; load part of file to memory
  394.         ; IN :    d0 = ULONG  size
  395.         ;    d1 = ULONG  offset
  396.         ;    a0 = CPTR   name of file
  397.         ;    a1 = APTR   destination
  398.         ; OUT :    d0 = BOOL   success
  399.         ;    d1 = ULONG  dos errorcode
  400.  
  401. ******* the following functions require ws_Version >= 8
  402.  
  403.     ULONG    resload_Relocate
  404.         ; relocate AmigaDOS executable
  405.         ; IN :    a0 = APTR   address (source=destination)
  406.         ;    a1 = STRUCT taglist
  407.         ; OUT :    d0 = ULONG  size
  408.     ULONG    resload_Delay
  409.         ; wait some time
  410.         ; IN :    d0 = ULONG  time to wait in 1/10 seconds
  411.         ; OUT :    -
  412.     ULONG    resload_DeleteFile
  413.         ; delete file
  414.         ; IN :    a0 = CPTR   filename
  415.         ; OUT :    d0 = BOOL   success
  416.         ;    d1 = ULONG  dos errorcode
  417.  
  418. ******* the following functions require ws_Version >= 10
  419.  
  420.     ULONG    resload_ProtectSMC
  421.         ; detect self modifying code
  422.         ; IN :    d0 = ULONG  length
  423.         ;    a0 = CPTR   address
  424.         ; OUT :    -
  425.     ULONG    resload_SetCPU
  426.         ; control CPU setup
  427.         ; IN :    d0 = ULONG  properties
  428.         ;    d1 = ULONG  mask
  429.         ; OUT :    d0 = ULONG  old properties
  430.     ULONG    resload_Patch
  431.         ; apply patchlist
  432.         ; IN :    a0 = APTR   patchlist
  433.         ;    a1 = APTR   destination address
  434.         ; OUT :    -
  435.  
  436. ******* the following functions require ws_Version >= 11
  437.  
  438.     ULONG    resload_LoadKick
  439.         ; load kickstart image
  440.         ; IN :    d0 = ULONG  length of image
  441.         ;    d1 = UWORD  crc16 of image
  442.         ;    a0 = CPTR   basename of image
  443.         ; OUT :    -
  444.     ULONG    resload_Delta
  445.         ; apply wdelta
  446.         ; IN :    a0 = APTR   src data
  447.         ;    a1 = APTR   dest data
  448.         ;    a2 = APTR   wdelta data
  449.         ; OUT :    -
  450.     ULONG    resload_GetFileSizeDec
  451.         ; get size of a packed file
  452.         ; IN :    a0 = CPTR   filename
  453.         ; OUT :    d0 = ULONG  size of file
  454.  
  455.     LABEL    resload_SIZEOF
  456.  
  457. ******* compatibility for older slave sources:
  458.  
  459. resload_CheckFileExist = resload_GetFileSize
  460.  
  461. ;=============================================================================
  462. ; commands used in patchlist
  463. ; each command follows the address to modify, if bit 16 of the command is
  464. ; cleared address follows as 32 bit, if bit 16 of the command is set it
  465. ; follows as 16 bit (unsigned extended to 32 bit)
  466.  
  467.     ENUM    0
  468.     EITEM    PLCMD_END        ;end of list
  469.     EITEM    PLCMD_R            ;set "rts"
  470.     EITEM    PLCMD_P            ;set "jmp"
  471.     EITEM    PLCMD_PS        ;set "jsr"
  472.     EITEM    PLCMD_S            ;set "bra.w" (skip)
  473.     EITEM    PLCMD_I            ;set "illegal"
  474.     EITEM    PLCMD_B            ;write byte to specified address
  475.     EITEM    PLCMD_W            ;write word to specified address
  476.     EITEM    PLCMD_L            ;write long to specified address
  477. ; version 11
  478.     EITEM    PLCMD_A            ;write address which is calculated as
  479.                     ;base + arg to specified address
  480. ; version 14
  481.     EITEM    PLCMD_PA        ;write address given by argument to
  482.                     ;specified address
  483.     EITEM    PLCMD_NOP        ;fill given area with nop instructions
  484.  
  485. ;=============================================================================
  486. ; macros to build patchlist
  487.  
  488. PL_START    MACRO            ;start of patchlist
  489. .patchlist
  490.         ENDM
  491.  
  492. PL_END        MACRO            ;end of patchlist
  493.     dc.w    PLCMD_END
  494.         ENDM
  495.  
  496. PL_CMDADR    MACRO            ;set cmd and address
  497.     IFLT $ffff-\2
  498.     dc.w    \1
  499.     dc.l    \2
  500.     ELSE
  501.     dc.w    $8000+\1
  502.     dc.w    \2
  503.     ENDC
  504.     ENDM
  505.  
  506. PL_R        MACRO            ;set "rts"
  507.     PL_CMDADR PLCMD_R,\1
  508.         ENDM
  509.  
  510. PL_PS        MACRO            ;set "jmp"
  511.     PL_CMDADR PLCMD_PS,\1
  512.     dc.w    \2-.patchlist        ;destination (inside slave!)
  513.         ENDM
  514.  
  515. PL_P        MACRO            ;set "jsr"
  516.     PL_CMDADR PLCMD_P,\1
  517.     dc.w    \2-.patchlist        ;destination (inside slave!)
  518.         ENDM
  519.  
  520. PL_S        MACRO            ;skip bytes, set "bra"
  521.     PL_CMDADR PLCMD_S,\1
  522.     dc.w    \2-2            ;distance
  523.         ENDM
  524.  
  525. PL_I        MACRO            ;set "illegal"
  526.     PL_CMDADR PLCMD_I,\1
  527.         ENDM
  528.  
  529. PL_B        MACRO            ;write byte
  530.     PL_CMDADR PLCMD_B,\1
  531.     dc.w    \2            ;data to write
  532.         ENDM
  533.  
  534. PL_W        MACRO            ;write word
  535.     PL_CMDADR PLCMD_W,\1
  536.     dc.w    \2            ;data to write
  537.         ENDM
  538.  
  539. PL_L        MACRO            ;write long
  540.     PL_CMDADR PLCMD_L,\1
  541.     dc.l    \2            ;data to write
  542.         ENDM
  543.  
  544. ; version 11
  545.  
  546. PL_A        MACRO            ;write address (base+arg)
  547.     PL_CMDADR PLCMD_A,\1
  548.     dc.l    \2            ;data to write
  549.         ENDM
  550.  
  551. ; version 14
  552.  
  553. PL_PA        MACRO            ;write address
  554.     PL_CMDADR PLCMD_PA,\1
  555.     dc.w    \2-.patchlist        ;destination (inside slave!)
  556.         ENDM
  557.  
  558. PL_NOP        MACRO            ;fill area with nop's
  559.     PL_CMDADR PLCMD_NOP,\1
  560.     dc.w    \2            ;distance
  561.         ENDM
  562.  
  563. ;=============================================================================
  564.  
  565.  ENDC
  566.